package inet.app.view.adapter;


import inet.app.R;
import inet.app.model.object.ListTinh_Sc_Item;

import java.util.ArrayList;
import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Typeface;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class ListTinhScAdapter extends ArrayAdapter<ListTinh_Sc_Item> {

	private ArrayList<ListTinh_Sc_Item> items;
	private Activity context;
	
	public ListTinhScAdapter(Context context, ArrayList<ListTinh_Sc_Item> items) {
		super(context, R.layout.list_item_tinh_sc,items);
		this.items = items;
		this.context = (Activity) context;
	}
	
	public ListTinhScAdapter(Context context, ArrayList<ListTinh_Sc_Item> items,ArrayList<String> item,ArrayList<String> path) {
		super(context, R.layout.list_item_tinh_sc,items);
		
		this.items = items;
		this.context = (Activity) context;
	}
	
	static class ViewHolder {
		protected ImageView imgright;
		protected TextView name;
		
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View v = null;
		if (convertView == null) {
			LayoutInflater inflater = context.getLayoutInflater();
			v = inflater.inflate(R.layout.list_item_tinh_sc, null);
			final ViewHolder vh = new ViewHolder();
			vh.imgright = (ImageView) v.findViewById(R.id.imgright);
			vh.name = (TextView) v.findViewById(R.id.tvname);
			v.setTag(vh);
		} else {
			v = convertView;
		}
		
		ViewHolder holder = (ViewHolder) v.getTag();
//		holder.imgright.setBackgroundResource(R.drawable.bt_right);
		holder.name.setText(items.get(position).getName());
		return v;
	}

}
